package com.inspinia.config.common.model;


import com.inspinia.base.common.model.NameCodeEnum;

/**
 * 配置中心key的值被修改后生效的时机
 * Created by veblen on 2017/2/14.
 */
public enum CfgCenterKeyEffectiveTiming implements NameCodeEnum {
    realTime(1, "实时的"),
    restart(2, "重启后生效");

    private final int code;
    private final String name;

    CfgCenterKeyEffectiveTiming(int code, String name) {
        this.code = code;
        this.name = name;
    }

    @Override
    public int getCode() {
        return this.code;
    }

    @Override
    public String getName() {
        return this.name;
    }

    public static CfgCenterKeyEffectiveTiming valueOf(int code) {
        for (CfgCenterKeyEffectiveTiming rs : CfgCenterKeyEffectiveTiming.values()) {
            if (rs.getCode() == code) {
                return rs;
            }
        }
        return null;
    }
}
